package com.longchat.domain.award;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="questionnaire")
public class Questionnaire {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	@Column(name="name")
	private String name;
	@Column(name="description")
	private String description;
	@Column(name="creat_time")
	private Date creatTime;
	@Column(name="cover_img")
	private String coverImg;
	@Column(name="total_voters")
	private Integer totalVoters;
	@Column(name="type")
	@Enumerated(EnumType.ORDINAL)
	private QuestionnarireType type;
	@OneToMany(cascade=CascadeType.ALL,mappedBy="questionnaire")
	private List<Option> options;
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreatTime() {
		return creatTime;
	}

	public void setCreatTime(Date creatTime) {
		this.creatTime = creatTime;
	}

	public String getCoverImg() {
		return coverImg;
	}

	public void setCoverImg(String coverImg) {
		this.coverImg = coverImg;
	}

	public Integer getTotalVoters() {
		return totalVoters;
	}

	public void setTotalVoters(Integer totalVoters) {
		this.totalVoters = totalVoters;
	}

	public List<Option> getOptions() {
		return options;
	}

	public void setOptions(List<Option> options) {
		this.options = options;
	}

	public QuestionnarireType getType() {
		return type;
	}

	public void setType(QuestionnarireType type) {
		this.type = type;
	}
	
	public enum QuestionnarireType{
		SIGNLE(0,"单选题"),
		MULTI(1,"多选题");
		private Integer code;
		private String value;
		QuestionnarireType(Integer code,String value){
			this.code=code;
			this.value = value;
		}
		public Integer getCode() {
			return code;
		}
		public void setCode(Integer code) {
			this.code = code;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
		
	}

	
}
